<extend name="Public/layout"/>
<block name="body">
    <div class="builder {$builder_class}">
        <div class="row">
            <notempty name="tab_list">
                <div class="col-xs-12">
                    <ul class="nav nav-tabs">
                        <volist name="tab_list" id="tab">
                            <li class="<php>if($current_tab == $key) echo 'active';</php>"><a href="{:U($tab_url, array('tab' => $key))}">{$tab}</a></li>
                        </volist>
                    </ul>
                    <div class="blank"></div>
                </div>
            </notempty>
            <notempty name="button_list">
                <div class="col-xs-12 col-sm-9 margin-bottom">
                    <volist name="button_list" id="button">
                        <a style="margin-right:5px;" {$button.attr}>89999{$button.title}</a>
                    </volist>
                </div>
            </notempty>
            <notempty name="search">
                <div class="col-xs-12 col-sm-3 margin-bottom">
                    <div class="input-group search-form">
                        <input type="text" name="keyword" class="search-input form-control" value="{$_GET.keyword}" placeholder="{$search.title}">
                        <span class="input-group-btn"><a class="btn btn-default" href="javascript:;" id="search" url="{$search.url}"><i class="glyphicon glyphicon-search"></i></a></span>
   
                    </div>         
                    
                    
                     
                </div>
                
                 <div class="col-xs-12  col-sm-9">
                                <form action="{:U('Export/delivery_order')}" method="post" class="form-inline">  
                                    <button class="btn btn-primary submit" type="submit" target-form="form">导出发货excel</button>     
                                    <div class="form-group">
                                        <input type="text"  style="width: 200px;" name="member_date" class="form-control daterange_set col-xs-5" placeholder="选择日期" readonly>
                                    </div>
                                </form>
                            </div>
            </notempty>

            <!-- 数据列表 -->
            <div class="col-xs-12">
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th><input class="check-all" type="checkbox"></th>
                                <th>编号</th>
                                <th>订单号</th>
                                <th>商品</th>
                                <th>支付方式</th>
                                <th>总金额</th>
                                <th>收货人</th>
                                <th>收货人手机</th>
                                <th>收货地址</th>
                                <th>下单时间</th>
                                <th style="text-align: center;">状态</th>
                                <th style="text-align: center;">操作</th>  
                            </tr>
                        </thead>
                        <tbody>
                        <volist name="data_list" id="data">
                            <tr>
                                <td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
                                <td>{$data.id}</td>
                                <td>{$data.order_no}</td>
                                <td>{$data.ids|check_goods_title}</td>
                                <td>{$data.pay_name}</td>
                                <td>{$data.total}</td>
                                <td>{$data.name}</td>
                                <td>{$data.phone}</td>
                                <td>{$data.province}{$data.city}{$data.area}{$data.address}</td>
                                <td>{$data.create_time|date="Y-m-d H:i",###}</td>
                                <td style="text-align: center;">
                                    {:get_order_status($data['pay_status'],$data['send_status'],$data['status'])}
                                </td>
                                <td style="text-align: center;">
                            <if condition="$data.status eq 1">
                                <a class="ajax-get confirm" href="{:U('Order/cancel',array('id'=>$data['id']))}">取消</a>
                            </if>
                            <if condition="$data.status eq 4">
                                <a href="{:U('Order/refund',array('id'=>$data['id']))}" class="confirm">退货</a>
                            </if>
                            <if condition="($data.send_status eq 0) and ($data.pay_status egt 2)">
                                <a href="{:U('Order/sendOut',array('id'=>$data['id']))}">发货</a>
                            </if>
                            <if condition="($data.send_status eq 2) and ($data.pay_status egt 2) and ($data.commission_status eq 0)">
                                <a class="ajax-get confirm" href="{:U('Order/giveOut',array('id'=>$data['id']))}">放佣</a>
                            </if>
                            <a href="{:U('Order/detail',array('id'=>$data['id']))}">详情</a>

                            </td>

                            </tr>
                        </volist>
                        </tbody>
                    </table>
                    <ul class="pagination"><notempty name="page">{$page}</notempty></ul>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });

        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        
        $(function () {
            //图表时间段选择
            $('.daterange_set').daterangepicker({
                startDate: moment().subtract(29, 'days'),
                endDate: moment(),
                minDate: '2016-01-01',
                maxDate: '2100-12-31',
                dateLimit: {days: 360},
                showDropdowns: true,
                showWeekNumbers: true,
                timePicker: false,
                timePickerIncrement: 1,
                timePicker12Hour: true,
                ranges: {
//                    '最近7天': [moment().subtract(6, 'days'), moment()],
//                    '这个月': [moment().startOf('month'), moment().endOf('month')],
//                    '上个月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
                },
                opens: 'right',
                buttonClasses: ['btn btn-default'],
                applyClass: 'btn-sm btn-primary',
                cancelClass: 'btn-sm',
                format: 'YYYY-MM-DD',
                separator: ' - ',
                locale: {
                    applyLabel: '确定',
                    cancelLabel: '清除',
                    fromLabel: '从',
                    toLabel: '到',
                    customRangeLabel: '自定义',
                    daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                    monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                    firstDay: 1
                }
            });
        });

        
    </script>
</block>


